<?php
use_javascript(url_for("js/setup.js"));
use_javascript(url_for("js/".$name.".filter.js"));
use_javascript(url_for("js/".$name.".tablesorter.js"));
use_javascript(url_for("js/".$name.".tabs.js"));

include_partial('view/filter', array('name' => $name, 'id' => 'filterDialog', 'filters' => $filters, 'ranks' => $ranks));
?>
<span class="" id="button">
    <ul id="button">
        <li class="fbutton ui-state-default ui-corner-all ui-allow-hover">
            <span class="ui-icon ui-icon-info"></span> Filters
        </li>
    </ul>
</span>
<table cellspacing="1" id="<?php echo $name ?>Table">
    <thead>
        <tr>
            <th width="100px" class="ui-widget ui-state-default ui-corner-tl ui-allow-hover">Name <span id="icon" class="ui-icon"></span></th>
            <th width="70px" class="ui-widget ui-state-default ui-allow-hover {sorter: 'classimage'}">Class <span id="icon" class="ui-icon ui-icon-triangle-s"></span></th>
            <th width="70px" class="ui-widget ui-state-default ui-allow-hover">Rank <span id="icon" class="ui-icon"></span></th>
            <th width="72px" class="ui-widget ui-state-default ui-allow-hover">Points <span id="icon" class="ui-icon"></span></th>
            <!--<th width="72px" class="ui-widget ui-state-default ui-allow-hover">Lifetime <span id="icon" class="ui-icon"></span></th>-->
            <th width="72px" class="ui-widget ui-state-default ui-allow-hover">30 Day <span id="icon" class="ui-icon"></span></th>
            <th width="72px" class="ui-widget ui-state-default ui-allow-hover">60 Day <span id="icon" class="ui-icon"></span></th>
            <th width="72px" class="ui-widget ui-state-default ui-corner-tr ui-allow-hover">Lifetime <span id="icon" class="ui-icon"></span></th>
        </tr>
        <tr>
            <th colspan="4" class="{sorter: false} ui-widget ui-state-default"></th>
            <th colspan="3" align="center" class="{sorter: false} ui-widget ui-state-default">Attendance</th>
        </tr>
    </thead>
    <tfoot>
        <tr>
            <th class="ui-widget ui-state-default ui-corner-bl"></th>
            <th class="ui-widget ui-state-default" colspan="5"></th>
            <th class="ui-widget ui-state-default ui-corner-br"></th>
        </tr>
    </tfoot>
    <tbody>
        <?php
        $lastPlayer = 1;
        $str = "";
        foreach ($players as $player)
        {
            if ($lastPlayer != $player->getId())
            {
                $lastPlayer = $player->getId();
                include_partial('view/tr_player_index', array('name' => $name, 'player' => $player));
            }
        }
        ?>
    </tbody>
</table>
